import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

class FFRichText {
  static RichText getRichText({
    TextAlign? textAlign,
    required List<InlineSpan>? children,
    int? maxLines = 999999,
  }) {
    return RichText(
      textAlign: textAlign ?? TextAlign.start,
      text: TextSpan(
        children: children,
      ),
      maxLines: maxLines,
      overflow: TextOverflow.ellipsis,
    );
  }

  /**
      recognizer: TapGestureRecognizer()..onTap = () async {}
   */
  static TextSpan getTextSpanChild({
    required String? txt,
    TextStyle? style,
    TapGestureRecognizer? recognizer,
  }) {
    return TextSpan(
      text: txt,
      style: style,
      recognizer: recognizer,
    );
  }

  static WidgetSpan getWidgetSpanChild({
    required Widget child,
    PlaceholderAlignment alignment = PlaceholderAlignment.bottom,
    TextBaseline? baseline,
    TextStyle? style,
  }) {
    return WidgetSpan(
      child: child,
      alignment: alignment,
      baseline: baseline,
      style: style,
    );
  }
}
